package com.zjh.photoshopstudy.app.upload;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.lzy.okserver.task.XExecutor;
import com.zjh.photoshopstudy.R;

public class UploadingActivity extends AppCompatActivity implements XExecutor.OnAllTaskEndListener {
    UploadingAdapter adapter;
    TextView textView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_uploading);
        textView = findViewById(R.id.textView10);
        RecyclerView recyclerView = findViewById(R.id.video_uploading);
        adapter = new UploadingAdapter(this, this);
        adapter.updateData();
        recyclerView.setAdapter(adapter);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        if (adapter.getItemCount() > 0) {
            textView.setVisibility(View.INVISIBLE);
        }
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        adapter.unRegister();
    }

    @Override
    public void onAllTaskEnd() {
        textView.setVisibility(View.VISIBLE);
    }
}
